package control;

/**
 * Validates input rules before data is passed to the model
 *
 * @author Kevin
 */
public class Validator {

    /**
     * Checks whether the input length is correct
     *
     * @param input String to be checked
     * @return true if OK, false otherwise
     */
    public static boolean validate(String input) {
        return verifyLength(input) && !input.isEmpty();
    }

    /**
     * Verifies the input field for text.length
     *
     * @param inputField from view
     * @return true or false
     */
    private static boolean verifyLength(String inputField) {
        return inputField.length() <= 20 && inputField.length() > 1;
    }
}
